package com.ics.web.controller.travelstar.controller;

import com.ics.web.controller.mail.service.MailService;
import com.ics.web.controller.travelstar.dto.MailDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author shaoly
 * @description
 * @ClassName MailController.java
 * @createTime 2025年02月12日 20:11:32
 */
@RestController
@RequestMapping("/mail")
@Api(value = "发送邮件", tags = "发送邮件接口")
public class MailController {

    @Resource
    private MailService mailService;

    @ApiOperation("sendSimpleMail")
    @PostMapping("/sendSimpleMail")
    public void sendSimpleMail(@RequestBody MailDTO mailDTO) {
        mailService.sendSimpleMail(mailDTO.getToMail(),
                mailDTO.getSubject(),
                mailDTO.getContent(),
                mailDTO.getCMail());
    }


    @ApiOperation("sendHtmlMail")
    @PostMapping("/sendHtmlMail")
    public void sendHtmlMail(@RequestBody MailDTO mailDTO) {
        mailService.sendHtmlMail(mailDTO.getToMail(),
                mailDTO.getSubject(),
                mailDTO.getContent(),
                mailDTO.getCMail());
    }

    @ApiOperation("sendFileMail")
    @PostMapping("/sendFileMail")
    public void sendFileMail(@RequestBody MailDTO mailDTO) {
        mailService.sendAttachmentsMail(mailDTO.getToMail(),
                mailDTO.getSubject(),
                mailDTO.getContent(),
                mailDTO.getFileUrl(),
                mailDTO.getCMail());
    }


}
